<template>
	<div class="login-container">
		<div class="login-content-left">
			<div class="login-logo">
				<span>{{ getThemeConfig.globalViceTitle }}</span>
			</div>
			<div style="width: 350px">
				<Account v-if="state.isTabPaneShow" />
				<Mobile v-else />
			</div>
			<div style="display: flex; justify-content: flex-start; width: 100%">
				<span class="login-content-left-change" @click="onTabsClick">{{ state.isTabPaneShow ? '手机登录' : '账号登录'
					}}<el-icon>
						<CaretRight />
					</el-icon></span>
			</div>
		</div>
		<el-divider style="height: 300px" direction="vertical" />
		<div class="login-content-right">
			<Scan />
			<div style="font-size: 12px; color: #687483; text-align: center">使用 手机 扫描二维码登录</div>
		</div>
	</div>
</template>

<script setup lang="ts">
import { reactive, computed } from 'vue';
import Account from '@/views/login/component/account.vue';
import Mobile from '@/views/login/component/mobile.vue';
import Scan from '@/views/login/component/scan.vue';
import { useThemeConfigStateStore } from '@/stores/themeConfig';

const theme = useThemeConfigStateStore();
const state = reactive({
	tabsActiveName: 'account',
	isTabPaneShow: true,
	isScan: false,
});
// 获取布局配置信息
const getThemeConfig = computed(() => {
	return theme.themeConfig;
});
// 切换密码、手机登录
const onTabsClick = () => {
	state.isTabPaneShow = !state.isTabPaneShow;
};
</script>

<style scoped lang="scss">
.login-container {
	width: 100%;
	height: 100%;
	// background: url('@/assets/bg-login.png') no-repeat;
	background-size: 100% 100%;
	background: #fff;
	display: flex;
	justify-content: center;
	gap: 50px;
	align-items: center;

	.login-content-left {
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;

		.login-content-left-change {
			color: #687483;
			letter-spacing: 2px;
			cursor: pointer;
			display: flex;
			align-items: center;

			&:hover {
				color: var(--color-primary);
			}
		}
	}

	.login-logo {
		// position: absolute;
		// top: 30px;
		// left: 50%;
		height: 50px;
		// display: flex;
		// align-items: center;
		color: var(--color-primary);
		letter-spacing: 2px;
		width: 100%;
		margin-bottom: 20px;

		>span {
			font-size: 35px;
			font-weight: bold;
			line-height: 50px;
			color: var(--color-primary);
			letter-spacing: 2px;
		}

		// transform: translateX(-50%);
	}

	.login-content {
		width: 500px;
		padding: 20px;
		position: absolute;
		top: 50%;
		left: 80%;
		transform: translate(-50%, -50%) translate3d(0, 0, 0);
		background-color: rgba(255, 255, 255, 0.99);
		border: 5px solid var(--color-primary-light-8);
		border-radius: 4px;
		transition: height 0.2s linear;
		height: 520px;
		overflow: hidden;
		transition: all 0.3s ease;
		z-index: 1;

		.login-content-main {
			margin: 0 auto;
			width: 80%;

			.login-content-title {
				color: #333;
				font-weight: 500;
				font-size: 22px;
				text-align: center;
				letter-spacing: 4px;
				margin: 15px 0 30px;
				white-space: nowrap;
				z-index: 5;
				position: relative;
				transition: all 0.3s ease;
			}
		}

		.login-content-icon {
			font-size: 25px;
			margin-right: 30px;
		}

		.login-content-main-sacn {
			position: absolute;
			top: 0;
			right: 0;
			width: 50px;
			height: 50px;
			overflow: hidden;
			cursor: pointer;
			transition: all ease 0.3s;

			&-delta {
				position: absolute;
				width: 35px;
				height: 70px;
				z-index: 2;
				top: 2px;
				right: 21px;
				background: var(--el-color-white);
				transform: rotate(-45deg);
			}

			&:hover {
				opacity: 1;
				transition: all ease 0.3s;
				color: var(--color-primary);
			}

			i {
				width: 47px;
				height: 50px;
				display: inline-block;
				font-size: 48px;
				position: absolute;
				right: 2px;
				top: -1px;
			}
		}
	}

	.login-content-mobile {
		height: 460px;
	}

	.login-copyright {
		position: absolute;
		left: 50%;
		transform: translateX(-50%);
		bottom: 30px;
		text-align: center;
		color: var(--color-whites);
		font-size: 12px;
		opacity: 0.8;

		.login-copyright-company {
			white-space: nowrap;
		}

		.login-copyright-msg {
			@extend .login-copyright-company;
		}
	}
}
</style>
